import http from '@/utils/Http.js'


//登录相关
//管理员信息
export function info(){
	return http({
		method:"get",
		url:"/auth/info"
	})
}
//管理员登录
export function login(data){
	return http({
		method:"post",
		url:"/auth/login",
		data
	})
}
//管理员退出登录
export function logout(){
	return http({
		method:"post",
		url:"/auth/logout",
	})
}


//角色管理
//角色列表--搜索--分页
export function list(name,page,limit){
	return http({
		method:"get",
		url:"/role/list",
		params:{
			name:name,
			page:page,
			limit:limit
		}
	})
}
//增加角色
export function create(data){
	return http({
		method:"post",
		url:"/role/create",
		data
	})
}
//修改角色
export function update(data){
	return http({
		method:"post",
		url:"/role/update",
		data
	})
}
//权限列表
export function permissions(data){
	return http({
		method:"get",
		url:"/role/permissions",
		params:data
	})
}
//删除角色
export function delet(data){
	return http({
		method:"post",
		url:"/role/delete",
		data
	})
}
//给角色配置权限 
export function rolepermissions(data){
	return http({
		method:"post",
		url:"/role/permissions",
		data
	})
}


//管理员
//管理员列表--搜索--分页
export function adminList(username,page,limit){
	return http({
		method:"get",
		url:"/admin/list",
		params:{
			username:username,
			page:page,
			limit:limit
		}
	})
}

//删除管理员
export function adminDelete(data){
	return http({
		method:"post",
		url:"/admin/delete",
		data
	})
}

//添加管理员
export function admincreate(data){
	return http({
		method:"post",
		url:"/admin/create",
		data
	})
}

//修改管理员
export function adminupdate(data){
	return http({
		method:"post",
		url:"/admin/update",
		data
	})
}


//通知管理--搜索--分页
export function noticeList(page,limit,title,content){
	return http({
		method:"get",
		url:"/notice/list",
		params:{
			page:page,
			limit:limit,
			title:title,
			content:content
		}
	})
}

//删除通知
export function noticeDelete(data){
	return http({
		method:"post",
		url:"/notice/delete",
		data
	})
}

//批量删除
export function batchDelete(data){
	return http({
		method:"post",
		url:"/notice/batch-delete",
		data
	})
}

//添加通知
export function batchCreate(data){
	return http({
		method:"post",
		url:"/notice/create",
		data
	})
}

//修改通知
export function batchUpdate(data){
	return http({
		method:"post",
		url:"/notice/update",
		data
	})
}

//广告管理
//广告列表--搜索--分页
export function adList(page,limit,name,content){
	return http({
		method:"get",
		url:"/ad/list",
		params:{
			page:page,
			limit:limit,
			name:name,
			content:content
		}
	})
}

//删除广告
export function adDelete(data){
	return http({
		method:"post",
		url:"/ad/delete",
		data
	})
}

//添加广告
export function adCreate(data){
	return http({
		method:"post",
		url:"/ad/create",
		data
	})
}

//编辑广告
export function adUpdate(data){
	return http({
		method:"post",
		url:"/ad/update",
		data
	})
}




//优惠券管理
//优惠券列表--搜索--分页
export function couponList(page,limit,name,type,status){
	return http({
		method:"get",
		url:"/coupon/list",
		params:{
			page : page,
			limit : limit,
			name : name,
			type : type,
			status : status
		}
	})
}


//删除优惠券
export function couponDelete(data){
	return http({
		method:"post",
		url:"/coupon/delete",
		data
	})
}



//增加优惠券
export function couponCreate(data){
	return http({
		method:"post",
		url:"/coupon/create",
		data
	})
}

//编辑优惠券
export function couponUpdate(data){
	return http({
		method:"post",
		url:"/coupon/update",
		data
	})
}


//优惠券详情
export function couponRead(id){
	return http({
		method:"get",
		url:"/coupon/read",
		params:id
	})
}


//topic/list
//专题管理
//专题列表
export function topicList(page,limit,title,subtitle,sort){
	return http({
		method:"get",
		url:"/topic/list",
		params:{
			page : page,
			limit : limit,
			title : title,
			subtitle : subtitle
		}
	})
}

//删除专题
export function topicDelete(data){
	return http({
		method:"post",
		url:"/topic/delete",
		data
	})
}


//批量删除
export function topicbatchDelete(data){
	return http({
		method:"post",
		url:"/topic/batch-delete",
		data
	})
}

//增加专题
export function topicCreate(data){
	return http({
		method:"post",
		url:"/topic/create",
		data
	})
}

//商品管理--列表
export function goodsList(page,limit,goodsId,name){
	return http({
		method:"get",
		url:"/goods/list",
		params:{
			page : page,
			limit : limit,
			goodsId : goodsId,
			name : name,
		}
	})
}
//商品管理--列表
export function goodsLi(goodsId){
	return http({
		method:"get",
		url:"/goods/list",
		params:goodsId
	})
}



//编辑专题
export function topicUpdate(data){
	return http({
		method:"post",
		url:"/topic/update",
		data
	})
}


///admin/order/list
//订单管理
//订单列表--搜索--分页
export function orderList(page,limit,timeArray,orderStatusArray,name){
	return http({
		method:"get",
		url:"/order/list",
		params:{
			page:page,
			limit:limit,
			timeArray:timeArray,
			orderStatusArray:orderStatusArray,
			name:name
		}
	})
}

//订单详情
export function orderDetail(id){
	return http({
		method:"get",
		url:"/order/detail",
		params:id
	})
}


///admin/category/list
//商品类目
export function categoryList(){
	return http({
		method:"get",
		url:"/category/list"
	})
}

//删除类目
export function categoryDelete(data){
	return http({
		method:"post",
		url:"/category/delete",
		data
	})
}
